package cn.sjlink.store.controller;

import cn.sjlink.store.form.LoginForm;
import cn.sjlink.store.service.ShopSiteService;
import cn.sjlink.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin("*")
@RestController
@RequestMapping("site")
public class ShopSiteController {

    @Autowired
    private ShopSiteService shopSiteService;

    @RequestMapping(value = "banner",method = RequestMethod.GET)
    public Result banner(String stackNo){
        return shopSiteService.banner(stackNo);
    }

    @RequestMapping(value = "login",method = RequestMethod.POST)
    public Result login(@RequestBody LoginForm loginForm){
        try {
            return shopSiteService.login(loginForm);
        } catch (Exception e) {
            return new Result(false,"登录失败，请重试");
        }
    }
}
